package com.多线程07.demo06;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class MyCallable implements Callable<String> {
    public String call() throws Exception {
        for (int i=0;i<10;i++){
            System.out.println(Thread.currentThread().getName()+"----"+i);
        }
        return Thread.currentThread().getName()+"线程执行完毕";
    }


    public static void main(String[] args) {
        MyCallable mc = new MyCallable();
        FutureTask<String> ft = new FutureTask<String>(mc);
        Thread thread = new Thread(ft);
        thread.setPriority(1);
        System.out.println(thread.getPriority());
        thread.start();


        MyCallable mc1 = new MyCallable();
        FutureTask<String> ft1 = new FutureTask<String>(mc1);
        Thread thread1 = new Thread(ft1);
        thread1.setPriority(10);
        System.out.println(thread1.getPriority());
        thread1.start();


    }


}
